import os
import base64


def RestoreFilename(dir, filename):
    f = filename
    filename = filename[::-1][6:][::-1]
    filename_base64 = filename[::-1] + '\n'
    filename_bytes_base64 = filename_base64.encode('ascii')  # encode as ASCII
    ori_filename = base64.decodebytes(filename_bytes_base64).decode('utf-8')
    new_filename = ori_filename

    # print(new_filename)
    print(os.path.join(dir, f))
    print(os.path.join(dir, new_filename))
    os.rename(os.path.join(dir, f), os.path.join(dir, new_filename))


RestoreFilename("e://test/", "0hHdu8GbsVGa.liuxp")
